<?php

namespace app\admin\validate;

use think\Validate;

class Personnel extends Validate
{
    protected $rule = [
        'name'             => 'require|unique:personnel',
        'sex'              => 'require',
        'mobile'            => 'require|unique:personnel',
        'patriarch_phone'  => 'require',
        'identity'         => 'require',
        'address'          => 'require',
        'position_id'      => 'require',
        'grade'            => 'require',
        'rank'             => 'require',
    ];

    protected $message = [
        'name.require'     => '用户名不能为空',
        'name.unique'      => '用户名已存在',
        'mobile.unique'     => '手机号已存在',
        'patriarch_phone.require'    => '家长手机号不能为空',
    ];
    protected $scene = [
        'edit'  => ['id','name', 'sex', 'mobile','patriarch_phone','identity','address','position_id','grade','rank','explain'],
        'add'  => ['name', 'sex', 'mobile','patriarch_phone','identity','address','position_id','grade','rank','explain'],
    ];
}


